/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.yonsei.iwb.srf.server;

import edu.yonsei.iwb.di.ESService;
import edu.yonsei.iwb.ts.TSSearch;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Onlyjiny
 */
public class SDTLearningServer {

    private ServerSocket server;
    private ESService di;
    private TSSearch ts;

    public SDTLearningServer() {
        try {
            di = new ESService();
            ts = new TSSearch();
            server = new ServerSocket(8080);            
        } catch (IOException ex) {
            Logger.getLogger(SDTLearningServer.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void handleConnection() {
        System.out.println("Ready to run decision trees...");
        while (true) {
            try {
                Socket socket = server.accept();
                SDTLearningHandler ch = new SDTLearningHandler(socket);
                ch.start();
            } catch (IOException ex) {
                Logger.getLogger(SDTLearningServer.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

    public static void main(String[] args) {
        SDTLearningServer example = new SDTLearningServer();
        example.handleConnection();
    }
}
